using IQIGame.Onigao.Framework;
using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Logic
{
    /// <summary>
    /// 服务触发器基类
    /// </summary>
    public abstract class BaseServiceTrigger : IReusableClass
    {
        /// <summary>
        /// 所属的服务
        /// </summary>
        protected LevelService _service = null;
        /// <summary>
        /// 触发参数
        /// </summary>
        protected BaseServiceTriggerConfig _paramConfig = null;
        /// <summary>
        /// 服务所属对象数据
        /// </summary>
        protected BaseLevelFunctionHost _host = null;

        //********************************************************

        public BaseServiceTrigger()
        {

        }

        /// <summary>
        /// 初始化
        /// </summary>
        public virtual void Init(BaseServiceTriggerConfig paramConfig)
        {
            this._paramConfig = paramConfig;
        }

        public virtual void SetData(LevelService service, BaseLevelFunctionHost host)
        {
            _service = service;
            _host = host;
        }

        /// <summary>
        /// 触发
        /// </summary>
        /// <param name="player"></param>
        /// <param name="dynamicObjParam">程序设置的动参数，用于触发器判断</param>"
        /// <param name="dynamicValueTypePram">程序设置的动参数，用于触发器判断</param>
        /// <returns>是否有任意执行成功生效</returns>
        public virtual bool OnTrigger(LevelPlayer player, object dynamicObjParam, TrigValueTypeParam dynamicValueTypePram)
        {
            return true;
        }

        public uint MaxStore => 100;

        public virtual void OnReset()
        {
            _paramConfig = null;
            _host = null;
            _service = null;
        }
    }

}



